import { getUserDepID, getCompanyID, getUserID } from '@/utils';

/** 材料转资产Manage数据范围权限判断 */
export const ToAssetControllerManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/assetApplyStuffasset/createCompanyID']) {
    return {
      createCompanyID: getCompanyID(),
      params: 'createCompanyID',
    };
  } else if (curRes?.['/assetApplyStuffasset/createDepartmentID']) {
    return {
      createDepartmentID: getUserDepID(),
      params: 'createDepartmentID',
    };
  } else if (curRes?.['/assetApplyStuffasset/createrID']) {
    return {
      createrID: getUserID(),
      params: 'createrID',
    };
  } else {
    return {};
  }
};

export const GetContractManageTab = (curRes: Record<string, any>) => {
  // if (curRes?.['/assetMaterial/createCompanyID']) {
  //   return {
  //     createCompanyID: getCompanyID(),
  //     params: 'createCompanyID',
  //   };
  // } else {
  //   return {};
  // }
  if (curRes?.['/assetMaterial/assetCompanyID']) {
    return {
      assetCompanyID: getCompanyID(),
      params: 'assetCompanyID',
    };
  } else {
    return {};
  }
};

/** 获取材料列表Manage数据范围权限判断 */
export const GetMaterialManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/assetStuff/dataGrid/createCompanyID']) {
    return {
      createCompanyID: getCompanyID(),
      params: 'createCompanyID',
    };
  } else if (curRes?.['/assetStuff/dataGrid/createDepartmentID']) {
    return {
      createDepartmentID: getUserDepID(),
      params: 'createDepartmentID',
    };
  } else if (curRes?.['/assetStuff/dataGrid/createrID']) {
    return {
      createrID: getUserID(),
      params: 'createrID',
    };
  } else {
    return {};
  }
};

/** 获取领用单列表Manage数据范围权限判断 */
export const GetReceiveManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/assetApplyStuffasset/getApplyUesStuff/createDepartmentID']) {
    return {
      createDepartmentID: getUserDepID(),
      params: 'createDepartmentID',
    };
  } else if (curRes?.['/assetApplyStuffasset/getApplyUesStuff/createrID']) {
    return {
      createrID: getUserID(),
      params: 'createrID',
    };
  } else {
    return {};
  }
};
